package com.stone.framework.message.basic.dict;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import io.swagger.annotations.ApiModelProperty;

public class DictMemberReqBody {

    @ApiModelProperty(value = "主键，新增时不使用")
    private Long id;

    @ApiModelProperty(value = "dictCategoryCode", required = true)
    @NotNull(message = "[dictCategoryCode] {title.notNull}")
    private String dictCategoryCode;

    @ApiModelProperty(value = "代码", required = true)
    @NotBlank(message = "[code] {title.notBlank}")
    private String code;

    @ApiModelProperty(value = "名称", required = true)
    @NotBlank(message = "[name] {title.notBlank}")
    private String name;

    @ApiModelProperty(value = "描述", required = true)
    @NotBlank(message = "[desc] {title.notBlank}")
    private String desc;

    @ApiModelProperty(value = "顺序", required = true)
    @NotNull(message = "[order] {title.notNull}")
    private Integer order;

    @ApiModelProperty(value = "状态：DISABLED|HIDDEN|ENABLED", required = true)
    @NotBlank(message = "[state] {title.notBlank}")
    @Pattern(regexp = "(DISABLED|HIDDEN|ENABLED)", message = "[state] must be 'DISABLED|HIDDEN|ENABLED'")
    private String state;

    @ApiModelProperty(value = "操作类型：ADD|UPD|DEL", required = true)
    @NotBlank(message = "[operationType] {title.notBlank}")
    @Pattern(regexp = "(ADD|UPD|DEL)", message = "[operationType] must be 'ADD|UPD|DEL'")
    private String operationType;

    @ApiModelProperty(hidden = true)
    public boolean isAdd() {
        return "ADD".equals(operationType);
    }

    @ApiModelProperty(hidden = true)
    public boolean isUpdate() {
        return "UPD".equals(operationType);
    }

    @ApiModelProperty(hidden = true)
    public boolean isDelete() {
        return "DEL".equals(operationType);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDictCategoryCode() {
        return dictCategoryCode;
    }

    public void setDictCategoryCode(String dictCategoryCode) {
        this.dictCategoryCode = dictCategoryCode;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getOrder() {
        return order;
    }

    public void setOrder(Integer order) {
        this.order = order;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getOperationType() {
        return operationType;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

}
